package com.pk.android.model;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.pk.android.R;

public class NavDrawerHeader implements NavDrawer {
	private int mIcon;
	private int mId;
	private String mText;
	
	public int getIcon() {
		return mIcon;
	}
	public void setIcon(int icon) {
		mIcon = icon;
	}
	@Override
	public String getText() {
		return mText;
	}
	public void setText(String text) {
		mText = text;
	}
	@Override
	public int getId() {
		return mId;
	}
	public void setId(int id) {
		mId = id;
	}
	
	
	public NavDrawerHeader(int id, String text, int imageResId)
	{
		this.setId(id);
		this.setText(text);
		this.setIcon(imageResId);
	}
	
	public static NavDrawerHeader create( int id, String text, int imageResId) {
        return new NavDrawerHeader(id, text, imageResId);
    }
	public static NavDrawerHeader create( int id, String text ) {
        return new NavDrawerHeader(id, text, 0);
    }

	@Override
	public int getViewType() {
		//return LayoutSectionType.HEADER_ITEM.ordinal();
		return -1;
	}
	
	@Override
	public View getView(LayoutInflater inflater, View convertView) {
		
		View rowView; 
		if (convertView == null) {
			rowView = inflater.inflate(R.layout.listview_navdrawer_header, null);
		} else {
			//rowView = convertView;
			rowView = inflater.inflate(R.layout.listview_navdrawer_header, null);
        }
		
	    TextView textView = (TextView) rowView.findViewById(R.id.txt_header);
	    ImageView imageViewItem = (ImageView) rowView.findViewById(R.id.icon);
	    
	    String s = this.getText();
	    textView.setText(s);

	    imageViewItem.setImageResource(getIcon());
	    
	    return rowView;
	}
	
	@Override
	public boolean isEnabled(int position) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
    public boolean updateActionBarTitle() {
		// TODO Auto-generated method stub
        return false;
    }
}
